cmake_minimum_required(VERSION 3.1)

project(wovncall)

SET(CMAKE_EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_EXECUTABLE_OUTPUT_PATH_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_EXECUTABLE_OUTPUT_PATH_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)

set(CMAKE_DEBUG_POSTFIX "d")

set(KXCAP_ROOT_DIR ${PROJECT_SOURCE_DIR}/kxcap)
set(KXUTIL_ROOT_DIR ${PROJECT_SOURCE_DIR}/kxutil)
set(KXFTP_ROOT_DIR ${PROJECT_SOURCE_DIR}/kxftp)
set(KXVNC_ROOT_DIR ${PROJECT_SOURCE_DIR}/kxvnc)

if(WIN32)
    set(ZLIB_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/zlib/winx)
    set(LIBOPENH264_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/openh264/winx)
    set(LIBPORTAUDIO_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/portaudio/winx)
    set(LIBOPUS_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/opus/winx)
    set(LIBJPEG_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/jpeg/winx)    
    set(LIBYUV_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/libyuv/winx)
    set(LIBQTSERVICE_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/qtservice/winx)
    file(GLOB MY_COPY_FILES ${LIBQTSERVICE_ROOT_DIR}/bin/qtserviced.*)
    file(GLOB MY_COPY_FILES ${MY_COPY_FILES} ${LIBQTSERVICE_ROOT_DIR}/bin/qtservice.*)
else()
    set(ZLIB_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/zlib/unix)
    set(LIBOPENH264_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/openh264/unix)
    set(LIBPORTAUDIO_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/portaudio/unix)
    set(LIBOPUS_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/opus/unix)
    set(LIBJPEG_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/jpeg/unix)
    set(LIBYUV_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/libyuv/unix)
    set(LIBQTSERVICE_ROOT_DIR ${PROJECT_SOURCE_DIR}/third/qtservice/unix)
endif()
file(COPY ${MY_COPY_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/bin)


message("copy file list:${MY_COPY_FILES}")
message("root path:${PROJECT_SOURCE_DIR}")

add_subdirectory(kxftp)
add_subdirectory(kxutil)
add_subdirectory(kxcap)
add_subdirectory(kxvnc)
add_subdirectory(client)
add_subdirectory(server)

